home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / autobahn.swf / scripts / frame_25 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  9.2 KB  |  432 lines

  1. function aspectCar(n)
  2. {
  3.    if(etat == "cool")
  4.    {
  5.       car.gotoAndStop(n);
  6.    }
  7. }
  8. function dehors()
  9. {
  10.    if(etat == "cool")
  11.    {
  12.       etat = "carton";
  13.       sons.gotoAndPlay("cartone");
  14.       car.gotoAndPlay(12);
  15.    }
  16. }
  17. function leJeu()
  18. {
  19.    if(etat == "carton")
  20.    {
  21.       car._y += 30;
  22.    }
  23.    if(etat == "cool")
  24.    {
  25.       if(F1.hitTest(zone_score))
  26.       {
  27.          if(compteF1 == 1)
  28.          {
  29.             score += niveau;
  30.             compteF1 = 0;
  31.          }
  32.       }
  33.       if(F2.hitTest(zone_score))
  34.       {
  35.          if(compteF2 == 1)
  36.          {
  37.             score += niveau;
  38.             compteF2 = 0;
  39.          }
  40.       }
  41.       if(F3.hitTest(zone_score))
  42.       {
  43.          if(compteF3 == 1)
  44.          {
  45.             score += niveau;
  46.             compteF3 = 0;
  47.          }
  48.       }
  49.       if(F4.hitTest(zone_score))
  50.       {
  51.          if(compteF4 == 1)
  52.          {
  53.             score += niveau;
  54.             compteF4 = 0;
  55.          }
  56.       }
  57.       if(F5.hitTest(zone_score))
  58.       {
  59.          if(compteF5 == 1)
  60.          {
  61.             score += niveau;
  62.             compteF5 = 0;
  63.          }
  64.       }
  65.       if(F6.hitTest(zone_score))
  66.       {
  67.          if(compteF6 == 1)
  68.          {
  69.             score += niveau;
  70.             compteF6 = 0;
  71.          }
  72.       }
  73.       if(F7.hitTest(zone_score))
  74.       {
  75.          if(compteF7 == 1)
  76.          {
  77.             score += niveau;
  78.             compteF7 = 0;
  79.          }
  80.       }
  81.       if(F8.hitTest(zone_score))
  82.       {
  83.          if(compteF8 == 1)
  84.          {
  85.             score += niveau;
  86.             compteF8 = 0;
  87.          }
  88.       }
  89.       if(F9.hitTest(zone_score))
  90.       {
  91.          if(compteF9 == 1)
  92.          {
  93.             score += niveau;
  94.             compteF9 = 0;
  95.          }
  96.       }
  97.       if(F10.hitTest(zone_score))
  98.       {
  99.          if(compteF10 == 1)
  100.          {
  101.             score += niveau;
  102.             compteF10 = 0;
  103.          }
  104.       }
  105.       temps += 1;
  106.       if(temps == 200)
  107.       {
  108.          niveau += 1;
  109.          temps = 0;
  110.       }
  111.    }
  112.    rap = 20;
  113.    alea = random(100);
  114.    n1 = v + F1._y / 60;
  115.    if(470 + alea < F1._y and 400 - niveau * rap < F5._y and 400 - niveau * rap < F9._y)
  116.    {
  117.       F1._xscale = 20;
  118.       F1._yscale = 20;
  119.       F1.gotoAndStop(random(3) + 1);
  120.       F1._x = 300;
  121.       F1._y = 0;
  122.    }
  123.    if(470 + alea >= F1._y)
  124.    {
  125.       compteF1 = 1;
  126.       F1._y += n1;
  127.       F1._x -= n1 / 2.9;
  128.       F1._xscale += n1 / 4;
  129.       F1._yscale += n1 / 4;
  130.    }
  131.    n5 = v + F5._y / 60;
  132.    if(470 + alea < F5._y and 350 - niveau * rap < F1._y and 350 - niveau * rap < F9._y)
  133.    {
  134.       F5._xscale = 20;
  135.       F5._yscale = 20;
  136.       F5.gotoAndStop(random(3) + 1);
  137.       F5._x = 300;
  138.       F5._y = 0;
  139.    }
  140.    if(470 + alea >= F5._y)
  141.    {
  142.       compteF5 = 1;
  143.       F5._y += n5;
  144.       F5._x -= n5 / 2.9;
  145.       F5._xscale += n5 / 4;
  146.       F5._yscale += n5 / 4;
  147.    }
  148.    n9 = v + F9._y / 60;
  149.    if(470 + alea < F9._y and 400 - niveau * rap < F1._y and 400 - niveau * rap < F5._y)
  150.    {
  151.       F9._xscale = 20;
  152.       F9._yscale = 20;
  153.       F9.gotoAndStop(random(3) + 1);
  154.       F9._x = 300;
  155.       F9._y = 0;
  156.    }
  157.    if(470 + alea >= F9._y)
  158.    {
  159.       compteF9 = 1;
  160.       F9._y += n9;
  161.       F9._x -= n9 / 2.9;
  162.       F9._xscale += n9 / 4;
  163.       F9._yscale += n9 / 4;
  164.    }
  165.    n2 = v + F2._y / 45;
  166.    if(470 + alea < F2._y and 350 - niveau * rap < F6._y and 350 - niveau * rap < F10._y)
  167.    {
  168.       F2._xscale = 20;
  169.       F2._yscale = 20;
  170.       F2.gotoAndStop(random(3) + 1);
  171.       F2._x = 315;
  172.       F2._y = 0;
  173.    }
  174.    if(470 + alea >= F2._y)
  175.    {
  176.       compteF2 = 1;
  177.       F2._y += n2;
  178.       F2._x -= n2 / 12;
  179.       F2._xscale += n2 / 4;
  180.       F2._yscale += n2 / 4;
  181.    }
  182.    n6 = v + F6._y / 45;
  183.    if(470 + alea < F6._y and 400 - niveau * rap < F2._y and 400 - niveau * rap < F10._y)
  184.    {
  185.       F6._xscale = 20;
  186.       F6._yscale = 20;
  187.       F6.gotoAndStop(random(3) + 1);
  188.       F6._x = 315;
  189.       F6._y = 0;
  190.    }
  191.    if(470 + alea >= F6._y)
  192.    {
  193.       compteF6 = 1;
  194.       F6._y += n6;
  195.       F6._x -= n6 / 12;
  196.       F6._xscale += n6 / 4;
  197.       F6._yscale += n6 / 4;
  198.    }
  199.    n10 = v + F10._y / 45;
  200.    if(470 + alea < F10._y and 400 - niveau * rap < F2._y and 400 - niveau * rap < F6._y)
  201.    {
  202.       F10._xscale = 20;
  203.       F10._yscale = 20;
  204.       F10.gotoAndStop(random(3) + 1);
  205.       F10._x = 315;
  206.       F10._y = 0;
  207.    }
  208.    if(470 + alea >= F10._y)
  209.    {
  210.       compteF10 = 1;
  211.       F10._y += n10;
  212.       F10._x -= n10 / 12;
  213.       F10._xscale += n10 / 4;
  214.       F10._yscale += n10 / 4;
  215.    }
  216.    n3 = v + F3._y / 30;
  217.    if(470 + alea < F3._y and 400 - niveau * rap < F7._y)
  218.    {
  219.       F3._xscale = 20;
  220.       F3._yscale = 20;
  221.       F3.gotoAndStop(random(3) + 1);
  222.       F3._x = 328;
  223.       F3._y = 0;
  224.    }
  225.    if(470 + alea >= F3._y)
  226.    {
  227.       compteF3 = 1;
  228.       F3._y += n3;
  229.       F3._x += n3 / 7;
  230.       F3._xscale += n3 / 4;
  231.       F3._yscale += n3 / 4;
  232.    }
  233.    n7 = v + F7._y / 30;
  234.    if(470 + alea < F7._y and 400 - niveau * rap < F3._y)
  235.    {
  236.       F7._xscale = 20;
  237.       F7._yscale = 20;
  238.       F7.gotoAndStop(random(3) + 1);
  239.       F7._x = 328;
  240.       F7._y = 0;
  241.    }
  242.    if(470 + alea >= F7._y)
  243.    {
  244.       compteF7 = 1;
  245.       F7._y += n7;
  246.       F7._x += n7 / 7;
  247.       F7._xscale += n7 / 4;
  248.       F7._yscale += n7 / 4;
  249.    }
  250.    n4 = v + F4._y / 20;
  251.    if(470 + alea < F4._y and 400 - niveau * rap < F8._y)
  252.    {
  253.       F4._xscale = 20;
  254.       F4._yscale = 20;
  255.       F4.gotoAndStop(random(3) + 1);
  256.       F4._x = 342;
  257.       F4._y = 0;
  258.    }
  259.    if(470 + alea >= F4._y)
  260.    {
  261.       compteF4 = 1;
  262.       F4._y += n4;
  263.       F4._x += n4 / 2.5;
  264.       F4._xscale += n4 / 4;
  265.       F4._yscale += n4 / 4;
  266.    }
  267.    n8 = v + F8._y / 20;
  268.    if(470 + alea < F8._y and 400 - niveau * rap < F4._y)
  269.    {
  270.       F8._xscale = 20;
  271.       F8._yscale = 20;
  272.       F8.gotoAndStop(random(3) + 1);
  273.       F8._x = 342;
  274.       F8._y = 0;
  275.    }
  276.    if(470 + alea >= F8._y)
  277.    {
  278.       compteF8 = 1;
  279.       F8._y += n8;
  280.       F8._x += n8 / 2.5;
  281.       F8._xscale += n8 / 4;
  282.       F8._yscale += n8 / 4;
  283.    }
  284. }
  285. function fabrique_message(cette_email)
  286. {
  287.    mon_message = "";
  288.    ma_longueur = cette_email.length;
  289.    ma_longueur_string = String(ma_longueur);
  290.    if(ma_longueur_string.length == 1)
  291.    {
  292.       ma_longueur_string = "0" + ma_longueur_string;
  293.    }
  294.    mon_message += ma_longueur_string;
  295.    mon_message += cette_email;
  296.    while(mon_message.length < 66)
  297.    {
  298.       mon_message += "k";
  299.    }
  300.    i = 0;
  301.    var_xor = 0;
  302.    while(i < 66)
  303.    {
  304.       j = ord(mon_message.charAt(i));
  305.       var_xor ^= j;
  306.       i++;
  307.    }
  308.    fin_xor = String(var_xor);
  309.    if(fin_xor.length == 1)
  310.    {
  311.       fin_xor = "00" + fin_xor;
  312.    }
  313.    if(fin_xor.length == 2)
  314.    {
  315.       fin_xor = "0" + fin_xor;
  316.    }
  317.    mon_message += fin_xor;
  318.    return mon_message;
  319. }
  320. function envoi_message(la_email)
  321. {
  322.    le_message_a_crypter = fabrique_message(la_email);
  323.    le_message_a_envoyer = crypte_message(le_message_a_crypter);
  324.    l_string_message = "php/update_scores.php?args=" + le_message_a_envoyer;
  325.    getURL(l_string_message,"_self","POST");
  326.    l_string_message = "php/lire_scores.php?args=1&idgame=230         &TimeStamp=" + String(l_temps.getDay() + l_temps.getHours() + l_temps.getMinutes() + l_temps.getSeconds());
  327.    loadVariables(l_string_message,_root.tableau_scores);
  328. }
  329. function ascii_philippe(le_char)
  330. {
  331.    le_code_ascii = ord(le_char);
  332.    if(le_code_ascii >= 48 && 57 >= le_code_ascii)
  333.    {
  334.       le_code_ascii -= 48;
  335.    }
  336.    else if(le_code_ascii >= 65 && 90 >= le_code_ascii)
  337.    {
  338.       le_code_ascii -= 55;
  339.    }
  340.    else if(le_code_ascii >= 97 && 122 >= le_code_ascii)
  341.    {
  342.       le_code_ascii -= 61;
  343.    }
  344.    else
  345.    {
  346.       if(le_char == "_")
  347.       {
  348.          le_code_ascii = 62;
  349.       }
  350.       if(le_char == "@")
  351.       {
  352.          le_code_ascii = 63;
  353.       }
  354.       if(le_char == ".")
  355.       {
  356.          le_code_ascii = 64;
  357.       }
  358.       if(le_char == "-")
  359.       {
  360.          le_code_ascii = 65;
  361.       }
  362.       if(le_char == "~")
  363.       {
  364.          le_code_ascii = 66;
  365.       }
  366.    }
  367.    return le_code_ascii;
  368. }
  369. function char_philippe(le_code_ascii)
  370. {
  371.    if(le_code_ascii < 10)
  372.    {
  373.       le_code_ascii += 48;
  374.       le_char = chr(le_code_ascii);
  375.    }
  376.    else if(le_code_ascii < 36)
  377.    {
  378.       le_code_ascii += 55;
  379.       le_char = chr(le_code_ascii);
  380.    }
  381.    else if(le_code_ascii < 62)
  382.    {
  383.       le_code_ascii += 61;
  384.       le_char = chr(le_code_ascii);
  385.    }
  386.    else if(le_code_ascii == 62)
  387.    {
  388.       le_char = "_";
  389.    }
  390.    else if(le_code_ascii == 63)
  391.    {
  392.       le_char = "@";
  393.    }
  394.    else if(le_code_ascii == 64)
  395.    {
  396.       le_char = ".";
  397.    }
  398.    else if(le_code_ascii == 65)
  399.    {
  400.       le_char = "-";
  401.    }
  402.    else if(le_code_ascii == 66)
  403.    {
  404.       le_char = "~";
  405.    }
  406.    return le_char;
  407. }
  408. function crypte_message(m_a_c)
  409. {
  410.    message_a_retourner = "";
  411.    code_precedent = 36;
  412.    ii = 68;
  413.    while(ii >= 0)
  414.    {
  415.       mon_char = m_a_c.charAt(ii);
  416.       nouveau_code = ascii_philippe(mon_char) + code_precedent;
  417.       if(66 < nouveau_code)
  418.       {
  419.          nouveau_code -= 67;
  420.       }
  421.       code_precedent = nouveau_code;
  422.       message_a_retourner = char_philippe(nouveau_code) + message_a_retourner;
  423.       ii--;
  424.    }
  425.    return message_a_retourner;
  426. }
  427. v = 0.8;
  428. temps = 0;
  429. niveau = 1;
  430. etat = "cool";
  431. score = 0;
  432.